package com.hue.gulimail.gulimailorder.config;

import com.hue.gulimail.gulimailorder.interceptor.LoginStatusInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: 姚凤桥
 * @Date: 2021/12/24 15:02
 * @Description:
 */
@Configuration
public class ViewConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("confirm.html").setViewName("confirm");
        registry.addViewController("detail.html").setViewName("detail");
        registry.addViewController("list.html").setViewName("list");
        registry.addViewController("pay.html").setViewName("pay");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginStatusInterceptor()).addPathPatterns("/**");
    }
}
